import { domainService } from "~/config/server";
import { NetService } from "~/utils/net.service";
import { Inject, Debounce } from "~/core/decorator";
import { Service } from "~/core/service";

export class CaseOperatorPageService extends Service {
  @Inject(NetService)
  private netService: NetService;

  /**
   * 新增地址
   * @param data
   */
  public addPersonalAddress(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.addPersonalAddress,
      data,
      loading: true
    });
  }
  /**
   * 查询外访附件
   */
  public queryVisitAttachment(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryVisitAttachment,
      data: {
        followRecordId: data
      }
    });
  }

  /**
   * 分页查询跟进
   */
  public caseFollowupRecord(data, page, sort) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.caseFollowupRecord,
      data,
      page,
      sort
    });
  }
  /**
   * 电话录音查询列表
   */
  public caseTelRecord(data, page, sort) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.caseTelRecord,
      data,
      page,
      sort
    });
  }

  /**
   * 增加催收总结
   */
  public addCaseTelRecord(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.addCaseTelRecord,
      data
    });
  }
  /**
   * 客户开户信息查询
   */
  public personalBankInfo(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.personalBankInfo,
      data: {
        caseId
      }
    });
  }
  /**
   * 客户联系人信息查询
   */
  @Debounce()
  public personalContacts(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.personalContacts,
      data: {
        caseId
      }
    });
  }
  /**
   * 客户信息查询
   */
  public personalInfo(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.personalInfo,
      data: {
        caseId
      }
    });
  }
  /**
   * 获取车贷订单信息
   */
   public queryCarLoanOrderInfo(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCarLoanOrderInfo,
      data: {
        caseId
      }
    });
  }
  /**
   * 查询车贷最新逾期信息
   */
     public queryRepayCarLoan(data,page) {
      return this.netService.send({
        server: domainService.caseOperatorPageController.queryRepayCarLoan,
        data,
        page
      });
    }
  /**
   * 查询车贷还款信息
   */
   public queryRepayRecordsCarLoan(data,page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryRepayRecordsCarLoan,
      data,
      page
    });
  }
  /**
   * 执行页顶部信息
   */
  @Debounce()
  public topInfo(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.topInfo,
      data: {
        caseId: data
      }
    });
  }

  /**
   * 客户房产信息
   */
  public queryPersonalHouse(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryPersonalHouse,
      data: {
        caseId
      }
    });
  }

  /**
   * 客户收支状况查询
   */
  public queryPersonalIncome(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryPersonalIncome,
      data: {
        caseId
      }
    });
  }

  /**
   * 产品信息查询
   */
  public queryProduct(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryProduct,
      data: {
        caseId
      }
    });
  }

  /**
   * 产品信息查询
   */
  public queryCaseInfo(caseId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseInfo,
      data: {
        caseId
      }
    });
  }
  /**
   * 共债信息查询
   */
  public queryDebtCaseInfo(data, page, sort) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryDebtCaseInfo,
      data,
      page,
      sort
    });
  }

  /**
   * 案件批注分页查询
   */
  public caseRemark(data, page, sort) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.caseRemark,
      data,
      page,
      sort
    });
  }

  /**
   * 添加案件批注
   */
  public addCaseRemark(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.addCaseRemark,
      data,
      loading: true
    });
  }

  /**
   * 客户联系人地址信息查询
   */
  public queryPersonalAddress(data, page, sort) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryPersonalAddress,
      data,
      page,
      sort
    });
  }

  // 删除地址
  public deletePersonalAddress(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.deletePersonalAddress,
      data,
      loading: true
    });
  }

  /**
   * 增加催收跟进
   */
  public addCaseFollowupRecord(append, data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.addCaseFollowupRecord,
      append,
      data,
      loading: true
    });
  }

  /**
   * 查询催收总结
   */
  public findCaseTelRecord(data, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.findCaseTelRecord,
      data,
      page
    });
  }

  /**
   * 申请历史
   */
  public caseApplyHistory(data, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.caseApplyHistory,
      data,
      page
    });
  }
  /**
   * 催收执行页面--通讯录--添加联系人
   * @param data
   * @param loading
   */
  @Debounce()
  public addPersonalContact(data: any) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.addPersonalContact,
      data,
      loading: true
    });
  }
  /**
   * 执行页--新增电话--自催和外包联系人电话等级下拉获取接口
   * @param data
   * @param loading
   */
  @Debounce()
  public getPhoneRankList() {
    return this.netService.send({
      server: domainService.caseOperatorPageController.getPhoneRankList,
      // data,
      loading: true
    });
  }
  /**
   * 催收执行页面--通讯录--删除联系人
   * @param data
   */
  @Debounce()
  public deletePersonalContact(personalId: string) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.deletePersonalContact,
      data: {
        id: personalId
      },
      loading: true
    });
  }

  /**
   * 催收执行页面--行动区--流转历史
   * @param data
   */
  public getAllCaseTurnRecords(data, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.getAllCaseTurnRecords,
      data,
      page
    });
  }

  /**
   * 催收执行页面--发送短信
   * @param data
   * @param loading
   */
  @Debounce()
  public sendSms(data: any) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.sendSms,
      data,
    });
  }

  /**
   * 催收执行页面--发送邮件
   * @param data
   * @param loading
   */
  @Debounce()
  public sendMail(data: any) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.sendMail,
      data,
      loading: true
    });
  }

  /**
   * 催收执行页面--发送短信--获取短信内容
   * @param data
   * @param loading
   */
  @Debounce()
  public getTemplateContent(data: any) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.getTemplateContent,
      data
    });
  }
  /**
   * 催收执行页--还款计划
   */
  @Debounce()
  public queryRepaymentPlan(data: any, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryRepaymentPlan,
      data: {
        caseId: data
      },
      page
    });
  }
  /**
   * 催收执行页--附件信息
   */
  @Debounce()
  public queryCaseUploadFile(data: any, page?, sort?) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseUploadFile,
      data: {
        caseId: data
      },
      page,
      sort
    })
  }
  /**
   * 更改风险客户标识
   */
  public modifyRiskFlag(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.modifyRiskFlag,
      data: {
        caseId: data
      },
    });
  }

  /**
   * 外放总结获取联系人信息
   */
  public getPersonalContactInfo(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.getPersonalContactInfo,
      data,
    });
  }

  /**
   * 增加法务催收跟进
   */
  public addCaseLegalRecord(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.addCaseLegalRecord,
      data,
    });
  }

  /**
   * 分页查询法务跟进
   */
  public queryCaseLegalRecord(data, page, sort) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseLegalRecord,
      data,
      page,
      sort,
    });
  }

  /**
   * 查询最新的未结案的法催记录
   */
  @Debounce()
  public queryUnClossCaseLegalRecord(data: any) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryUnClossCaseLegalRecord,
      data: {
        caseId: data
      }
    })
  }
  /**
   * 通过id查询法催记录
   */
  @Debounce()
  public queryCaseLegalRecordById(data: any) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseLegalRecordById,
      data: {
        id: data
      }
    })
  }
  /**
   * 查询执行立案法院名称去重
   */
  @Debounce()
  public queryExecuteCourtName() {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryExecuteCourtName
    })
  }
  public queryWarehouseChangeRecords(data, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryWarehouseChangeRecords,
      data,
      page
    });
  }
  /**
   * 单个附件删除
   */
  public deleteCaseUploadFileById(fileId) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.deleteCaseUploadFileById,
      data: {
        fileId
      }
    });
  }

  public getCaseInfoRecordIdById(caseInfoRecordId) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.getCaseInfoRecordIdById,
      data: {
        caseInfoRecordId
      }
    });
  }

  public caseHistoryTrack(data, page, sort?) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.caseHistoryTrack,
      data,
      page,
      sort
    });
  }

  public updateCaseRemarkTop(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.updateCaseRemarkTop,
      data,
      loading: true
    });
  }
  public queryCaseDetailInfo(caseId) {
    console.log('caseId',caseId);

    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseDetailInfo,
      data: {
        caseId
      }
    });
  }

  public queryCaseOverdueInfo(caseId) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseOverdueInfo,
      data: {
        caseId
      }
    });
  }

  public queryCaseEntityInfo(caseId) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseEntityInfo,
      data: {
        caseId
      }
    });
  }

  public queryLoanInfo(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryLoanInfo,
      data
    });
  }

  public queryRepayLoanInfo(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryRepayLoanInfo,
      data
    });
  }

  public queryPersonalInfo(caseId) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryPersonalInfo,
      data: {
        caseId
      }
    });
  }

  public applyPauseCaseActive(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.applyPauseCaseActive,
      data
    });
  }

  public findSmsRecordLog(data, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.findSmsRecordLog,
      data,
      page
    });
  }
  // 实时还款查询
  public queryRepayRecords(data, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryRepayRecords,
      data,
      page
    });
  }
  // 短信记录查询
  public findSmsSendLog(data, page) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.findSmsSendLog,
      data,
      page
    });
  }
  // 还款信息查询
  public queryCaseRepaymentInfo(data) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.queryCaseRepaymentInfo,
      data
    });
  }

  /**
   * 更新催记-编辑列表
   */
   @Debounce()
   public updateCaseFollowupRecord(data: any) {
     return this.netService.send({
       server: domainService.caseOperatorPageController.updateCaseFollowupRecord,
       data
     })
   }
  /**
   * 增加电催催收跟进
   */
  @Debounce()
  public increaseCaseFollowupRecord(data: any) {
    return this.netService.send({
      server: domainService.caseOperatorPageController.increaseCaseFollowupRecord,
      data,
    })
  }
  /**
   * 下载录音
   */
   @Debounce()
   public getRecordByRecordId(data: any) {
     return this.netService.send({
       server: domainService.caseOperatorPageController.getRecordByRecordId,
       data,
     })
   }

}
